<include file="Public:header"/>

<body class="fixed skin-green">
    <div class="wrapper">
        <!-- Main Header -->
        <header class="main-header">
            <!-- Header Navbar -->
            <nav class="navbar navbar-static-top" role="navigation"></nav>
        </header>
        <!-- Main sidebar -->
      <include file="Public:menu"/>
        <!-- Content Wrapper -->
        <div class="content-wrapper">
            <section class="content-header">
                <h1> 编辑新闻</h1>
            </section>
            <section class="content">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="box box-change-basic">
                            <div class="box-header">
                                <!-- <h3 class="box-title">广告信息</h3> -->
                            </div>
                            <div class="box-body">
                                <form class="form-horizontal" action="__URL__/update" method="post"  enctype="multipart/form-data" id="from-add-banner">
                                    <div class="form-group">
                                        <label for="ad-name" class="col-sm-3 control-label">标题</label>
                                        <div class="col-sm-7">
                                            <input type="text" name="title"class="form-control" value="{$news.title}" id="ad-name" placeholder="标题包括标点不超过12个字">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="ad-content" class="col-sm-3 control-label">简介</label>
                                        <div class="col-sm-7">
                                            <input type="text" class="form-control" id="ad-content"
                                            name="content" value="{$news.content}" placeholder="简介包括标点不超过36字">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="ad-link" class="col-sm-3 control-label">链接</label>
                                        <div class="col-sm-7">
                                            <input type="text" name="url" class="form-control" value="{$news.url}"id="ad-link" placeholder="请输入链接">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="trueName" class="col-sm-3 col-xs-12 control-label">时间</label>
                                        <div class="col-sm-3 col-xs-5">
                                            <input type="date" name="start_time" value="<neq name="news.start_time" value="0">{$news.start_time|date="Y-m-d",###}</neq>" class="form-control" id="startTime" placeholder="格式: xxxx-xx-xx">
                                        </div>
                                        <div class="col-sm-1 col-xs-2">
                                            <div style="text-align: center;line-height:34px;">至</div>
                                        </div>
                                        <div class="col-sm-3 col-xs-5">
                                            <input type="date" name="end_time" value="<neq name="news.end_time" value="0">{$news.end_time|date="Y-m-d",###}</neq>" class="form-control" id="endTime" placeholder="格式: xxxx-xx-xx">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="ad-link" class="col-sm-3 control-label">图片</label>
                                        <div class="col-sm-4">
                                            <div class="ad-images-box ad-listview">
                                                <img class="avatar" src="__PUBLIC__/news_img/{$news.img}" >
                                            </div>
                                        </div>
                                        <div class="col-sm-3">
                                            <div class="btn-group">
                                                <input type="file" id="" name="img" class="file hide">
                                                <button type="button" id="btn-choose-img" class="btn btn-default">选择图片</button>
                                            </div>
                                            <p> 请上传250px*170px尺寸图片 </p>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="ad-sort" class="col-sm-3 control-label">排序</label>
                                        <div class="col-sm-3">
                                            <input type="text" class="form-control" id="ad-sort"
                                            name="sort" value="{$news.sort}">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">上线</label>
                                        <div class="col-sm-7">

                                            <label class="radio-inline">
                                                <input type="radio" name="status" id="inlineRadio1" value="1" <eq name="news.status" value="1">checked</eq>>是
                                            </label>
                                            <label class="radio-inline">
                                                <input type="radio" name="status" id="inlineRadio2"value="0"  <eq name="news.status" value="0">checked</eq>>否
                                            </label>
                                        </div>
                                    </div>
                                    <input type="hidden" name="id" value="{$news.id}">
                                </form>

                            </div>
                        </div>
                        <!-- /.box -->
                    </div>
                </div>
            </section>
            <div class="content-footer">
            	<div class="btn-group">
            	    <button type="submit" class="btn btn-default" id="btn-submit">保存</button>
            	</div>
            </div>
        </div>
        <!-- Main Footer -->
        <footer class="main-footer">
            <!-- To the right -->
            <div class="pull-right hidden-xs">
                Version 1.0
            </div>
            <!-- Default to the left -->
            <strong>Copyright &copy; 2015 <a href="#">viva</a>.</strong> All rights reserved.
        </footer>
    </div>
    <!-- REQUIRED JS SCRIPTS -->
    <script src="__PUBLIC__/admin/js/jquery-1.11.3.min.js"></script>
    <script src="__PUBLIC__/admin/js/bootstrap.min.js"></script>
    <script src="__PUBLIC__/admin/js/common.js"></script>
    <script>
        $(function() {
            admin.init();
            // 图片上传前预览
            $('#btn-choose-img').on('click', function(event) {
            	event.preventDefault();
            	$(this).prev().trigger('click');
            	$(this).prev().on('change', function(event) {
            	    admin.previewImage(this,$('.ad-images-box')[0]);
            	});
            });
            // 提交表单
            $('#btn-submit').on('click', function(event) {
                event.preventDefault();
                $('#from-add-banner').submit();
            });
        });
    </script>
</body>

</html>
